<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>

  *{
   margin:0;
   padding:0
  }
  img{
    width: 1226px;
    height: 460px;
    display: block;
    margin:20px auto;
  }
  ul{
    width: 1000px;
    margin: 0 auto;
  }
  ul li{
    list-style: none;
    width: 200px;
    float: left;
  
   
  }
  ul li img{
    width: 200px;
    height: 50px;
  }
  .border{
    border: 2px  solid red;
  }
  </style>
</head>

<body>
 <img src="img/m1.jpg" class="banner">
  <ul>
    <li><img src="img/m1.jpg" class="border" alt=""></li>
    <li><img src="img/m2.jpg" alt=""></li>
    <li><img src="img/m3.jpg" alt=""></li>
    <li><img src="img/m4.jpg" alt=""></li>
    <li><img src="img/m5.jpg" alt=""></li>
  </ul>
</body>

  <script>
  //获取要改变的元素
  var banner = document.getElementsByClassName('banner');
  console.dir(banner);
  //获取点击的元素
  var imgs = document.querySelectorAll('ul li img');
  //b绑定事件
  for(var i=0 ;i<imgs.length;i++){
    imgs[i].onclick=function(){
      //获取当前点击img  的src
      var src = this.src;
      //banner是类数组  要找到指定的元素(节点  dom对象)
      banner[0].src = src;
      //排他思想
      for(var j=0;j<imgs.length;j++){
        imgs[j].classList.remove('border');
      }
      this.classList.add('border');
    }
    
  }
  </script>
</html>